import React, { Component } from 'react';
import { connect } from 'react-redux';
import { Switch, Route, Redirect } from "react-router-dom";
import { privateRoute } from "../routers"
import Nav from "./Nav"
class App extends React.Component {
    constructor(props, context) {
        super(props, context);
    }
    render() {
        return <Nav>
            <Switch>
                {
                    privateRoute.map((item, index) => {
                        return <Route path={item.pathname} component={item.component} key={index} />
                    })

                }
                <Redirect from="/admin" to={privateRoute[0].pathname} exact />
                <Redirect to='/404' exact />
            </Switch>
        </Nav>





    }
}

export default connect()(App);